package com.sugar.persistence.system.privilege.impl;

import java.util.LinkedHashMap;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.sugar.common.base.persistence.IHibernateBaseDaoSupport;
import com.sugar.common.base.persistence.query.PageModel;
import com.sugar.domain.system.privilege.PrivilegeRole;
import com.sugar.persistence.system.privilege.IPrivilegeRole;

@Repository
public class PrivilegeRoleDao extends IHibernateBaseDaoSupport<PrivilegeRole> implements IPrivilegeRole{

	@Override
	public void deletePrivilegeRoleDao(PrivilegeRole role)
			throws RuntimeException {
		this.deleteEntityBaseDao(role) ;
	}

	@Override
	public void deleteSelectPrivilegeRoleDao(Object[] ids)
			throws RuntimeException {
		this.deleteEntityMoreIdBaseDao(PrivilegeRole.class, ids) ;
	}

	@Override
	public List<PrivilegeRole> findPrivilegeRoleDao(String queryString,
			String whereStr, Object[] param,
			LinkedHashMap<String, String> orderby) throws RuntimeException {
		
		return this.findMoreEntityByParam(queryString, null, null, orderby) ;
	}

	@Override
	public PageModel<PrivilegeRole> getScorllPrivilegeRoleDao(
			String queryString, String whereStr, Object[] param, int firstPage,
			int pageSize, LinkedHashMap<String, String> orderby)
			throws RuntimeException {
		
		return this.getScrollRecord(queryString, null, param, firstPage, pageSize, orderby) ;
	}

	@Override
	public PrivilegeRole loadPrivilegeRoleByIdDao(int id)
			throws RuntimeException {
		
		return this.getEntityById(PrivilegeRole.class, id) ;
	}

	@Override
	public void savePrivilegeRoleDao(PrivilegeRole role)
			throws RuntimeException {
		this.saveEntityBaseDao(role) ;
	}

	@Override
	public void updatePrivilegeRoleDao(PrivilegeRole role)
			throws RuntimeException {
		System.out.println(role.getR_name()+"ccccccc");
		this.updateEntityBaseDao(role) ;
	}

}
